# -*- coding: utf-8 -*-
# @Time    : 2021/8/31 14:32
# @Author  : BrandonGT
# @FileName: 07_PyQt5_QToolButton.py
# 1. 导入包和模块
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys

# 2. 创建一个应用程序对象
app = QApplication(sys.argv)

# 3. 创建控件
window = QWidget()

# 3.1 设置控件
window.setWindowTitle("")
window.resize(500, 500)


tb = QToolButton(window)
tb.setText("aaaa")
tb.setIcon(QIcon("xxx.jpg"))
tb.setIconSize(QSize(60, 60))
tb.setToolTip("asdkjlaskdjlkas")
# tb.setToolButtonStyle(Qt.ToolButtonIconOnly)
# tb.setToolButtonStyle(Qt.ToolButtonTextOnly)
# tb.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
# tb.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
tb.setToolButtonStyle(Qt.ToolButtonFollowStyle)

tb2 = QToolButton(window)
tb2.resize(100, 50)
tb2.move(100, 50)
tb2.setArrowType(Qt.UpArrow)
tb2.setAutoRaise(True)

# 3.2 展示控件
window.show()

# 4. 应用程序执行，进入消息循环
sys.exit(app.exec_())